package com.wnxy.sddfp.search.controller;

import com.wnxy.sddfp.common.model.page.Pages;
import com.wnxy.sddfp.common.result.Result;
import com.wnxy.sddfp.search.model.query.BorrowRecordSearchQuery;
import com.wnxy.sddfp.search.model.vo.BorrowRecordVo;
import com.wnxy.sddfp.search.service.ISearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 搜索服务
 */
@RestController
@RequestMapping("/search")
@Api(tags = "搜索服务")
public class SearchController {

    @Autowired
    private ISearchService searchService;

    @ApiOperation("借款记录搜索")
    @PostMapping("/borrowRecord")
    public Result<Pages<BorrowRecordVo>> searchBorrowRecord(
            @RequestBody BorrowRecordSearchQuery borrowRecordSearchQuery){
        Pages<BorrowRecordVo> pages =
                searchService.searchBorrowRecord(borrowRecordSearchQuery);
        return Result.ok(pages);
    }
}
